#!/usr/bin/perl

open(IN,"/sbin/ifconfig|");
%name_addr;
while(<IN>){
  if(/^\w+/)
    {
      @data=split / /, $_;
      $host_name=$data[0];
      #print "$host_name\n";
    }
  if(/^\s*inet addr:([\d\.]*)/)#\s*Bcast:([\d\.]*)\s*Mask:([\d\.]*)/)
    {
      $host_ip=$1;
      #print "$host_ip\n";
      $name_addr{$host_name}=$host_ip;
    }
}
while(($key,$value)=each%name_addr){
  print "$key => $value\n";
}
